package com.leesche.zcsp.node.pay.cmbc.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 加载民生银行配置文件
 * @author reid
 * @Created 16/11/16
 */
public class ConfigUtil {
    private static String propPath = "cmbc/cmbc_config.properties";
    private static Properties prop = null;

    static {
//        System.out.println("propPath=" + propPath);
        prop = new Properties();
        InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propPath);
        try {
            prop.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getProperty(String keyName) {
        return prop.getProperty(keyName);
    }

    public static String getProperty(String keyName, String defaultValue) {
        return prop.getProperty(keyName, defaultValue);
    }

    public static void main(String[] args) {
//        System.out.println(getProperty("merchant_no"));
//        System.out.println(getProperty("trans_url"));
//        System.out.println(getProperty("public_key_path"));
//        System.out.println(getProperty("private_key_path"));
//        System.out.println(getProperty("private_key_pfx_path"));
//        System.out.println(getProperty("private_key_pwd"));
    }
}
